import url from "@/axios/url";

const { mesUrl} = url();
export const exportUrl = `${mesUrl}quote/exportQuoteConfirm?quoteStateList=1,2`


export const exportExlUrl = `${mesUrl}quote/exportConfirmExl/`;


export const operateList = [
  {
    name: $i18n.t("common.export"),
    type: "primary",
    icon: "el-icon-download",
    handleName: "export", //点击时返回的标识
    url: exportUrl,
    //auth: "auth:operlog:export", //权限字段
  }
]

// 行末按钮配置
export const rowConfig = [
  {
    name: '确认',
    type: 'primary',
    class: 'row-btn-primary',
    handleName: 'edit' // 点击时返回的标识
  },
  {
    name: '导出',
    type: 'primary',
    class: 'row-btn-primary',
    handleName: 'exportExl', // 点击时返回的标识,
  },
]
// 搜索条件配置
export const searchConfig = {
  data() {
    const self = this
    return {
      searchDialog: {
        inline: true,
        formDesc: {
          orderCode: {
            type: 'input',
            label: '编号'
          },
          vinCode: {
            type: 'input',
            label: 'VIN'
          },
          modelName: {
            type: 'input',
            label: '车型'
          },
          // quoteState: {
          //   type: 'select',
          //   label: '状态',
          //   options: (data) => {
          //     return [
          //       {
          //         text: "未创建",
          //         value: '-1'
          //       },
          //       {
          //         text: "草稿",
          //         value: '0'
          //       },
          //       {
          //         text: "推送",
          //         value: '1'
          //       },
          //       {
          //         text: "确认",
          //         value: '2'
          //       },
          //     ]
          //   }
          // },
          pushState: {
            type: 'select',
            label: '推送状态',
            options: (data) => {
              return [
                {
                  text: "未推送",
                  value: '0'
                },
                {
                  text: "部分推送",
                  value: '1'
                },
                {
                  text: "全部推送",
                  value: '2'
                },
              ]
            }
          },
          confimState: {
            type: 'select',
            label: '确认状态',
            options: (data) => {
              return [
                {
                  text: "未确认",
                  value: '0'
                },
                {
                  text: "部分确认",
                  value: '1'
                },
                {
                  text: "全部确认",
                  value: '2'
                },
              ]
            }
          },
        }
      }
    }
  }
}
// 新增/删除表单配置
export const formDescDialogMixin = {
  data() {
    const self = this
    return {
      formDescDialog: {
        span: 24,
        labelPosition: 'top',
        formDesc: {
          customerName: {
            type: 'input',
            label: '客户名称',
            layout: 6,
            attrs: { readonly: true }
          },
          vehicleGuidePrice: {
            type: 'input',
            label: '新车指导价',
            layout: 6,
            attrs: { readonly: true }
          },
          orderCode: {
            type: 'input',
            label: '订单编号',
            layout: 6,
            attrs: { readonly: true }
          },
          modelName: {
            type: 'input',
            label: '车型',
            layout: 6,
            attrs: { readonly: true }
          },
          modelColor: {
            type: 'input',
            label: '车身颜色',
            layout: 6,
            attrs: { readonly: true }
          },
          vinCode: {
            type: 'input',
            label: 'VIN码',
            layout: 6,
            attrs: { readonly: true }
          },
          mileage: {
            type: 'input',
            label: '里程数(km)',
            layout: 6,
            attrs: { readonly: true }
          },
          vehicleRegisterDate: {
            type: 'input',
            label: '首次上牌日期',
            layout: 6,
            attrs: { readonly: true }
          },
          repairList: {
            label: '维修项目费用',
            layout: 24,
            type: 'table-editor',
            attrs: {
              // 校检规则
              isShowDelete:false,
              isShowAdd: false,
              topBtnRender: (h, solt) => {
                return (
                  <div>
                    <el-button
                      type="primary"
                      onClick={() => {
                        self.ConfirmAllIn()
                      }}>
                      全部确认需要
                    </el-button>
                    <el-button
                      type="primary"
                      onClick={() => {
                        self.ConfirmAllOut()
                      }}>
                      全部确认不需要
                    </el-button>
                  </div>
                )
              },
              // extraBtns: [
              //   {
              //     text: "确认需要",
              //     attrs: {
              //       type: "text",
              //     },
              //     style: {
              //       color: '#6caaf5'
              //     },
              //     click(scope) {
              //       console.log(scope.row)
              //       self.doConfirm(scope.row.id,self.mainId)
              //     }
              //   },
              //   {
              //     text: "确认不需要",
              //     attrs: {
              //       type: "text",
              //     },
              //     style: {
              //       color: '#F56C6C'
              //     },
              //     click(scope) {
              //       console.log(scope)
              //     }
              //   },
              // ],
              // 表格列
              //   字段已对完
              columns: [
                {
                  // el-table-column 的属性
                  type: 'index',
                  width: 50
                },
                {
                  prop: 'partsName',
                  label: '部件',
                  minWidth: 80,
                  showOverflowTooltip: true
                },
                {
                  prop: 'descConcat',
                  label: '部件描述',
                  minWidth: 80,
                  showOverflowTooltip: true
                },
                {
                  prop: 'repairItem',
                  label: '维修项目',
                  minWidth: 80,
                  showOverflowTooltip: true
                },
                {
                  prop: 'repairQuote',
                  label: '工时报价(元)',
                  minWidth: 80,
                },
                {
                  prop: 'itemName',
                  label: '物料名称',
                  minWidth: 160,
                },
                {
                  prop: 'state',
                  label: '物料状态',
                  minWidth: 80,
                },
                {
                  prop: 'materialType',
                  label: '物料品质',
                  minWidth: 80,
                },
                {
                  prop: 'itemCount',
                  label: '物料数量',
                  minWidth: 80,
                },
                {
                  prop: 'countUnitShow',
                  label: '领用单位',
                  minWidth: 80,
                },
                {
                  prop: 'unitPrice',
                  label: '成本价',
                  minWidth: 80,
                },
                {
                  prop: 'unitPriceJc',
                  label: '加成价',
                  minWidth: 80,
                },
                {
                  prop: 'itemQuote',
                  label: '物料报价(元)',
                  minWidth: 80,
                },
                {
                  prop: 'isConfirm',
                  label: '确认状态',
                  minWidth: 80,
                  content: {
                    attrs: ({ row }) => {
                      return {
                        disabled: row.isConfirmOg !== "0" ,
                      };
                    },
                    type: "el-select",
                    options: [
                      {text: "待确认", value: "0" },
                      { text: "确认需要", value: "1" },
                      { text: "确认不需要", value: "2" },
                    ],
                  },
                }
              ],

              // 新行默认值
              newColumnValue: {
                lineNum: 0,
                count: 0
              }
            }
          },
          extraList: {
            label: '固定收费项目',
            layout: 24,
            required: true,
            type: 'table-editor',
            attrs: {
              isShowAdd: false,
              isShowDelete: false,
              columns: [
                {
                  prop: 'extraName',
                  label: '项目',
                  showOverflowTooltip: true
                },
                {
                  prop: 'extraQuoteCoef',
                  label: '系数(%)',
                  showOverflowTooltip: true,
                },
                {
                  prop: 'extraQuoteRate',
                  label: '费率(%)',
                  showOverflowTooltip: true,
                },
                {
                  prop: 'extraQuote',
                  label: '价格(元)',
                }
              ],

              // 新行默认值
              newColumnValue: {
                lineNum: 0,
                count: 0
              }
            }
          },
          mark: {
            type: 'textarea',
            label: '备注',
            layout: 24,attrs: { readonly: true }
          }
        }
      }
    }
  }
}
